package cn.edu.seu.ssny.service.impl;

import cn.edu.seu.ssny.dao.IStatisticsConfigDao;
import cn.edu.seu.ssny.dao.support.IBaseDao;
import cn.edu.seu.ssny.entity.Device;
import cn.edu.seu.ssny.entity.Project;
import cn.edu.seu.ssny.entity.StatisticsConfig;
import cn.edu.seu.ssny.entity.StatisticsType;
import cn.edu.seu.ssny.service.IStatisticsConfigService;
import cn.edu.seu.ssny.service.support.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("statisticsDeviceService")
public class StatisticsConfigServiceImpl extends BaseServiceImpl<StatisticsConfig, Long> implements IStatisticsConfigService {

    @Autowired
    private IStatisticsConfigDao statisticsDeviceDao;

    /**
     * 功能描述:
     * <根据项目和统计类型查询出所有需要被统计的配置项
     *
     * @param project
     * @param statisticsTypeId
     * @return
     */
    @Override
    public List<StatisticsConfig> getDeviceIdsByProjectIdAndStatisticsTypeId(Project project, Integer statisticsTypeId) {
        return statisticsDeviceDao.findStatisticsConfigsByProjectAndStatisticsTypeId(project, statisticsTypeId);
    }

    /**
     * 功能描述:
     * <根据统计类型ID查询出所有需要被统计的采集点ID
     *
     * @param statisticsTypeId
     * @return
     */
    @Override
    public List<Integer> getDeviceIdsByStatisticsType(int statisticsTypeId) {
        return null;
//        return statisticsDeviceDao.getDeviceIdsByStatisticsType(statisticsTypeId);
    }

    /**
     * 功能描述:
     * <根据指定的条件查询分析配置项
     *
     * @param statisticsTypeId
     * @param project
     * @param device
     * @return
     */
    @Override
    public StatisticsConfig findByStatisticsTypeIdAndProjectAndDevice(Integer statisticsTypeId, Project project, Device device) {
        return statisticsDeviceDao.findStatisticsConfigsByProjectAndStatisticsTypeIdAndDevice(project, statisticsTypeId,device);
    }


    @Override
    public IBaseDao<StatisticsConfig, Long> getBaseDao() {
        return this.statisticsDeviceDao;
    }
}
